//
// Created by liushuai on 12/8/19.
//
#include "insertsort.h"
<<<<<<< HEAD:cxx/algorithm/src/insertsort.cc
#include <iostream>

void insertsort(std::vector<int>& sortVec) {
    int size = sortVec.size();

    for (int need_sort_index = 1; need_sort_index < size; need_sort_index++) {
        int insert_value = sortVec.at(need_sort_index);
        int start_index = need_sort_index - 1;
        while (start_index >= 0 && insert_value < sortVec.at(start_index)) {
            sortVec[start_index+1] = sortVec[start_index];//移动
            start_index -= 1;
        }
        sortVec.at(start_index+1) = insert_value;
    }

=======

#include <iostream>

void insertsort(std::vector<int>& sortVec) {
  int size = sortVec.size();

  for (int need_sort_index = 1; need_sort_index < size; need_sort_index++) {
    int insert_value = sortVec.at(need_sort_index);
    int start_index = need_sort_index - 1;
    while (start_index >= 0 && insert_value < sortVec.at(start_index)) {
      sortVec[start_index + 1] = sortVec[start_index];  // 移动
      start_index -= 1;
    }
    sortVec.at(start_index + 1) = insert_value;
  }
>>>>>>> dev:cxx/algorithm/common/src/insertsort.cc
}
